<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="docker" />
	<meta name="description" content="Deploy Seata Server By Docker" />
	<!-- 网页标签标题 -->
	<title>Deploy Seata Server By Docker</title>
  <link rel="shortcut icon" href="/img/seata_logo_small.jpeg"/>
	<link rel="stylesheet" href="/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/en-us/index.html"><img class="logo" src="//img.alicdn.com/tfs/TB1gqL1w4D1gK0jSZFyXXciOVXa-1497-401.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><span class="language-switch language-switch-normal">中</span><div class="header-menu"><img class="header-menu-toggle" src="https://img.alicdn.com/tfs/TB14eEmw7P2gK0jSZPxXXacQpXa-38-32.png"/><ul><li class="menu-item menu-item-normal"><a href="/en-us/index.html" target="_self">HOME</a></li><li class="menu-item menu-item-normal menu-item-normal-active"><a href="/en-us/docs/overview/what-is-seata.html" target="_self">DOCS</a></li><li class="menu-item menu-item-normal"><a href="/en-us/docs/developers/developers_dev.html" target="_self">DEVELOPERS</a></li><li class="menu-item menu-item-normal"><a href="/en-us/blog/index.html" target="_self">BLOG</a></li><li class="menu-item menu-item-normal"><a href="/en-us/community/index.html" target="_self">COMMUNITY</a></li><li class="menu-item menu-item-normal"><a href="/en-us/blog/download.html" target="_self">DOWNLOAD</a></li></ul></div></div></header><div class="bar"><div class="bar-body"><img src="https://img.alicdn.com/tfs/TB1cm8nJwDqK1RjSZSyXXaxEVXa-160-160.png" class="front-img"/><span>Documentation</span><img src="https://img.alicdn.com/tfs/TB1cm8nJwDqK1RjSZSyXXaxEVXa-160-160.png" class="back-img"/></div></div><section class="content-section"><div class="sidemenu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>Overview</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/overview/what-is-seata.html" target="_self">What is Seata?</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/overview/terminology.html" target="_self">Terminology</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/overview/faq.html" target="_self">FAQ</a></li></ul></li><li class="menu-item menu-item-level-1"><span>User Doc</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/user/quickstart.html" target="_self">Quick Start</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/user/api.html" target="_self">API Guide</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/user/microservice.html" target="_self">Microservices Framework Supports</a></li></ul></li><li class="menu-item menu-item-level-1"><span>Developer Guide</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Transaction Mode<img style="transform:rotate(-90deg)" class="menu-toggle" src="https://img.alicdn.com/tfs/TB15.Ilw2b2gK0jSZK9XXaEgFXa-26-16.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/dev/mode/at-mode.html" target="_self">Seata AT mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/dev/mode/tcc-mode.html" target="_self">Seata TCC mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/dev/mode/saga-mode.html" target="_self">Seata Saga mode</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/dev/seata-mertics.html" target="_self">Metrics design</a></li></ul></li><li class="menu-item menu-item-level-1"><span>Ops Guide</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/ops/multi-configuration-isolation.html" target="_self">Configuration Isolation</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Deploy<img style="transform:rotate(-90deg)" class="menu-toggle" src="https://img.alicdn.com/tfs/TB15.Ilw2b2gK0jSZK9XXaEgFXa-26-16.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-server.html" target="_self">Deploy Directly</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-by-docker.html" target="_self">Deploy by Docker</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-by-kubernetes.html" target="_self">Deploy by Kubernetes</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-by-helm.html" target="_self">Deploy by Helm</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-ha.html" target="_self">Deploy in High Available Usage</a></li></ul></li></ul></li></ul></div><div class="doc-content markdown-body"><h1>Deploy Seata Server By Docker</h1>
<h2>Quick Start</h2>
<h4>Start a seata-server instance</h4>
<pre><code class="language-bash">$ docker run --name seata-server -p 8091:8091 seataio/seata-server:latest
</code></pre>
<h4>Specify server IP and port</h4>
<pre><code class="language-bash">$ docker run --name seata-server \
        -p 8091:8091 \
        -e SEATA_IP=192.168.1.1 \
        -e SEATA_PORT=8091 \
        seataio/seata-server
</code></pre>
<h4>Docker compose</h4>
<p>Example of <code>docker-compose.yaml</code></p>
<pre><code class="language-yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">"3"</span>
<span class="hljs-attr">services:</span>
<span class="hljs-attr">  seata-server:</span>
<span class="hljs-attr">    image:</span> <span class="hljs-string">seataio/seata-server</span>
<span class="hljs-attr">    hostname:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">    ports:</span>
<span class="hljs-bullet">      -</span> <span class="hljs-string">"8091:8091"</span>
<span class="hljs-attr">    environment:</span>
<span class="hljs-bullet">      -</span> <span class="hljs-string">SEATA_PORT=8091</span>
<span class="hljs-bullet">      -</span> <span class="hljs-string">STORE_MODE=file</span>
</code></pre>
<h2>Access container and view log</h2>
<pre><code class="language-bash">$ docker <span class="hljs-built_in">exec</span> -it seata-server sh
</code></pre>
<pre><code class="language-bash">$ docker logs -f seata-server
</code></pre>
<h2>Using custom configuration file</h2>
<p>Custom configuration implement by mount <code>registry.conf</code> and <code>file.conf</code> to container.</p>
<ul>
<li>Specify registry.conf</li>
</ul>
<p>The environment variable<code>SEATA_CONFIG_NAME</code> is required when use a custom configuration , and the value must be started with <code>file:</code> like <code>file:/root/seata-config/registry</code>:</p>
<pre><code class="language-bash">$ docker run --name seata-server \
        -p 8091:8091 \
        -e SEATA_CONFIG_NAME=file:/root/seata-config/registry \
        -v /User/seata/config:/root/seata-config  \
        seataio/seata-server
</code></pre>
<p>The param <code>-e</code> specify environment, and the param <code>-v</code> specify mount volume.</p>
<ul>
<li>Specify file.conf</li>
</ul>
<p>If you need specify <code>file.conf</code>, just modify <code>config</code> like below in <code>registry.conf</code> file:</p>
<pre><code>config {
  type = &quot;file&quot;

  file {
    name = &quot;file:/root/seata-config/file.conf&quot;
  }
}
</code></pre>
<h2>Environment Variables</h2>
<p>You can modify configuration of seata-server  by the environment variables like this:</p>
<ul>
<li><strong>SEATA_IP</strong></li>
</ul>
<blockquote>
<p>The variable is optional,  specifies registry IP instead of the container IP in registry center like eureka or others.</p>
</blockquote>
<ul>
<li><strong>SEATA_PORT</strong></li>
</ul>
<blockquote>
<p>The variable is optional, specifies seata-server port, default is <code>8091</code></p>
</blockquote>
<ul>
<li><strong>STORE_MODE</strong></li>
</ul>
<blockquote>
<p>The variable is optional, specifies the log store mode of seata-server,  support <code>db</code> and <code>file</code>, default is <code>file</code>.</p>
</blockquote>
<ul>
<li><strong>SERVER_NODE</strong></li>
</ul>
<blockquote>
<p>The variable is optional, specifies  the seata-server node ID, like <code>1</code>,<code>2</code>,<code>3</code>..., default is <code>1</code></p>
</blockquote>
<ul>
<li><strong>SEATA_ENV</strong></li>
</ul>
<blockquote>
<p>The variable is optional, specifies the seata-server environment, like <code>dev</code>, <code>test</code> etc. Then server will find file like <code>registry-dev.conf</code> under the configuration path when start.</p>
</blockquote>
<ul>
<li><strong>SEATA_CONFIG_NAME</strong></li>
</ul>
<blockquote>
<p>The variable is optional, specifies the configuration file path, like the <code>file:/root/registry</code>, will load file<code>/root/registry.conf</code> as configuration. If need specify <code>file.conf</code> configuration，the <code>config.file.name</code> value in <code>registry.conf</code> file need to change as related config, like <code>file:/root/file.conf</code></p>
</blockquote>
</div></section><footer class="footer-container"><div class="footer-body"><img src="//img.alicdn.com/tfs/TB1dGrSwVT7gK0jSZFpXXaTkpXa-4802-1285.png"/><p class="docsite-power">website powered by docsite</p><div class="cols-container"><div class="col col-12"><h3>Vision</h3><p>Seata is an Alibaba open source distributed transaction solution that delivers high performance and easy to use distributed transaction services under a microservices architecture.</p></div><div class="col col-6"><dl><dt>Documentation</dt><dd><a href="/en-us/docs/overview/what-is-seata.html" target="_self">What is Seata?</a></dd><dd><a href="/en-us/docs/user/quickstart.html" target="_self">Quick Start</a></dd><dd><a href="https://github.com/seata/seata.github.io/issues/new" target="_self">Report a doc issue</a></dd><dd><a href="https://github.com/seata/seata.github.io" target="_self">Edit This Page on GitHub</a></dd></dl></div><div class="col col-6"><dl><dt>Resources</dt><dd><a href="/en-us/blog/index.html" target="_self">Blog</a></dd><dd><a href="/en-us/community/index.html" target="_self">Community</a></dd></dl></div></div><div class="copyright"><span>Copyright © 2019 Seata</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '';
  </script>
	<script src="/build/documentation.js"></script>
	<script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?104e73ef0c18b416b27abb23757ed8ee";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
    </script>
</body>
</html>
